class Solution
{
public:
    int minimumTimeToInitialState(string word, int k)
    {
        int n = word.size();
        int step = 1;
        while (true)
        {
            int len = step * k;
            if (len >= n)
            {
                return step;
            }
            int left = n - len;
            if (word.substr(0, left) == word.substr(n - left, left))
            {
                return step;
            }
            step++;
        }

        return -1;
    }
};